Skip to content

GH-50527: [C++] Remove ARROW_SSE4_2_FLAG for x86 MSVC#50526

Open
loctormor wants to merge 1 commit into
apache:mainfrom
loctormor:patch-1
Open

GH-50527: [C++] Remove ARROW_SSE4_2_FLAG for x86 MSVC#50526
loctormor wants to merge 1 commit into
apache:mainfrom
loctormor:patch-1

Conversation

@loctormor

@loctormor loctormor commented Jul 16, 2026

Copy link
Copy Markdown

The SSE4.2 flag is invalid for the MSVC x86 compiler, and ignored by x64 as an automatic extension of the default (SSE2).
https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86

Rationale for this change

MSVC builds generate hundreds of nuisance warnings that resemble:
cl : Command line warning D9002 : ignoring unknown option '/arch:SSE4.2'

What changes are included in this PR?

Simple replacement of the MSVC-specific flag "/arch:SSE4.2" with an empty string. This matches a working configuration prior to ~July 2025, at which time the flag seems to have been edited while adding xsimd definitions below.

Are these changes tested?

Yes - using cmake version 3.29.6 and both the VC17 and VC18 compilers.

Are there any user-facing changes?

No. This only affects developers building the source code and has no impact on the Apache Arrow libraries.

@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@github-actions
github-actions Bot marked this pull request as draft July 16, 2026 21:34
@loctormor loctormor changed the title Remove ARROW_SSE4_2_FLAG for x86 MSVC GH-50527: [C++] Remove ARROW_SSE4_2_FLAG for x86 MSVC Jul 16, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50527 has been automatically assigned in GitHub to PR creator.

# x86/amd64 compiler flags, msvc/gcc/clang
if(MSVC)
set(ARROW_SSE4_2_FLAG "/arch:SSE4.2")
set(ARROW_SSE4_2_FLAG "")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this only for x86 environment?
This disables SSE 4.2 on x64 environment too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSE4.2 appears to behave identically for x64. The official Microsoft documentation lists SSE4.2 as valid flag for msvc-180, but the compiler begs to disagree. I am having trouble finding documentation to support this, but building with x64 does produce the same nuisance warnings as with x86. This appears to be because SSE2 and its extensions are implicitly targeted as the baseline. Here is the relevant usage line on my machine:

Command> "C:\Program Files\Microsoft Visual Studio\18\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe" /? 2>nul | findstr "arch:"

[Output]
/arch:<AVX|AVX2|AVX512> minimum CPU architecture requirements, one of:

Next week I will expand the scope of testing to see if there is any MSVC version that supports the SSE4.2 flag without warnings.

@loctormor loctormor Jul 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: The flag is invalid for all "cl.exe" executables that ship with Visual Studio 2022 (VC17) and Visual Studio 2026 (VC18).

Valid flags for x86:
/arch:<IA32|SSE|SSE2|AVX|AVX2|AVX512>
Valid flags for x64:
/arch:<AVX|AVX2|AVX512>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Could you add a comment why we don't need /arch:SSE4.2 that is mentioned in the documented on both of x86 and x64?

@loctormor
loctormor marked this pull request as ready for review July 23, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants